package com.gxa.controller.employee;

import com.gxa.common.R.ResponseData;
import com.gxa.service.employee.SelectBoxService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 下拉选项框controller层
 */
@Controller
@Api(value = "下拉选项框test",tags = "下拉选项框接口API")
@RequestMapping("/xiala")
public class selectBoxController {
    @Autowired(required = false)
    private SelectBoxService selectBoxService;

    //7个下拉选项框
    //从变量数据表中返回员工职称字段用于渲染所在部门下拉多选框
    @RequestMapping(value = "/selectBox",method = RequestMethod.GET)
    @ApiOperation(value = "下拉单选框",notes = "从变量数据表中返回所有下拉单选框字段用于渲染下拉单选框",
                                                httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public ResponseData selectBox() {
        return selectBoxService.selectBox();
    }

    //从数据库中返回所有部门名称用于渲染   所在部门下拉多选框
    @RequestMapping(value = "/selectAllDepartment",method = RequestMethod.GET)
    @ApiOperation(value = "所在部门下拉多选框",notes = "从数据库中返回所有部门名称用于渲染所在部门下拉多选框",
                                                    httpMethod = "get", response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public ResponseData selectAllDepartment() {
        return selectBoxService.selectAllDepartment();
    }
}
